﻿using System.Collections.Generic;
using Dicide.Components;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace Dicide.Views
{
    public sealed partial class CompenentSelector : UserControl
    {
        public List<FrameworkElement> Components { get; private set; }

        public CompenentSelector()
        {
            Components = new List<FrameworkElement>();
            Components.Add(new Clock());
            Components.Add(null);
            Components.Add(new Light());
            Components.Add(new Wire());
            Components.Add(new Corner());
            Components.Add(new Tee());
            this.InitializeComponent();
        }

        public FrameworkElement SelectedComponent
        {
            get { return (FrameworkElement)GetValue(SelectedComponentProperty); }
            set { SetValue(SelectedComponentProperty, value); }
        }

        public static readonly DependencyProperty SelectedComponentProperty =
            DependencyProperty.Register("SelectedComponent", typeof(FrameworkElement),
                typeof(CompenentSelector), new PropertyMetadata(null));

        private void GridViewSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SelectedComponent = MyGridView.SelectedItem as FrameworkElement;
        }
    }
}
